package com.simon.cdc.event;


import cn.hutool.json.JSONObject;
import lombok.Getter;

import java.io.Serializable;

/**
 * CDC变更事件数据载体
 */
@Getter
public final class ChangeEvent  {
    public enum OperationType { INSERT, UPDATE, DELETE, READ }

    // Getter方法
    private final String tableName;
    private final OperationType operationType;
    private final JSONObject beforeState;
    private final JSONObject afterState;
    private final JSONObject primaryKeys;

    public ChangeEvent(String tableName, OperationType operationType,
                      JSONObject beforeState, JSONObject afterState,
                      JSONObject primaryKeys) {
        this.tableName = tableName;
        this.operationType = operationType;
        this.beforeState = beforeState;
        this.afterState = afterState;
        this.primaryKeys = primaryKeys;
    }

}